import App from './App'
import Tools from '@/util/Tools';
import store from './store/index'   //引入vuex
// #ifndef VUE3
import Vue from 'vue'
import GoEasy from './lib/js_sdk/GoEasy-IM/goeasy-2.4.6.min.js';
// 挂载vuex
Vue.prototype.$store = store;

Vue.config.productionTip = false
// import uView from '@/uni_modules/uview-ui'
// Vue.use(uView)
// 如此配置即可
Vue.prototype.$tools = Tools;
App.mpType = 'app'
const app = new Vue({
    ...App,
	store 
})
const goEasy = GoEasy.getInstance({
	host:'hangzhou.goeasy.io',//应用所在的区域地址: 【hangzhou.goeasy.io |singapore.goeasy.io】
	// appkey:'BC-059c87a69c354f00b3f5d94b455f475a',	// common key,测试
	appkey:'BC-8dd4ea137a574baca6e8ef9dc210b06d',	// common key,正式
    modules:['im']
});
// if (uni.getSystemInfoSync().platform !== "devtools") {  
//     console.log = () => {}  
// }
goEasy.onClickNotification((message) => {
	let currentUrl;
	const routes = getCurrentPages();

	if ( routes &&  routes.length ) {
		const curRoute = routes[routes.length - 1].route;
		const curParam = routes[routes.length - 1].options;
		currentUrl = '/' + curRoute + `?to=${curParam.to}`;
	}
	//单聊天跳转路径
    let newUrl = '/pages/chat/privateChat/privateChat?to=' + message.senderId;
   
    if (currentUrl !== newUrl) {
        uni.navigateTo({
            url: newUrl,
        });
    }

});

Vue.prototype.GoEasy = GoEasy;
Vue.prototype.goEasy = goEasy;
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif